from rest_framework.generics import GenericAPIView
from rest_framework.generics import ListCreateAPIView,RetrieveUpdateDestroyAPIView

from book.models import BookInfo
from book.serializers import BookSerializer

class BooksView(ListCreateAPIView):
    """
        获取所有图书和保存图书
    """
    # 指定序列化器属性
    serializer_class = BookSerializer
    # 指定查询集属性
    queryset = BookInfo.objects.all()


class BookView(RetrieveUpdateDestroyAPIView):
    """
        获取单一图书
        更新
        删除
    """
    # 指定序列化器属性
    serializer_class = BookSerializer
    # 指定查询集属性
    queryset = BookInfo.objects.all()
